package com.tao.mvpbaselibrary.basic.network;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public abstract class BaseRxHttpConsumer<T> implements Observer<T> {
    private Disposable disposable;
    public void onSubscribe(Disposable d) {
        BaseRxHttpConsumer.this.disposable = d;
    }

    public void onNext(T o) {
        onRespons(o);
    }

    public void onError(Throwable throwable) {
 
    }

    public void onComplete() {
           
    }

    protected abstract void onRespons(T t);

    public void disposable() {
        if (disposable != null && !disposable.isDisposed()) {
            disposable.dispose();
        }
        disposable = null;
    }
}
